IAxis.CyclicSwitch method

Uses an axis' position to control a switch that triggers a digital output repeatedly. When an axis reaches a certain position, a switch is turned on or off. A switch can be controlled by a forward and backward movement of an axis.

Namespace: IntervalZero.KINGSTAR.Base.Class

Assembly: IntervalZero.KINGSTAR.Base.Class (in IntervalZero.KINGSTAR.Base.dll) Version: 4.4.0.0

Syntax

C#VB
void DigitalCamSwitch(
       McOutput output,
       double startPosition,
       McCamSwitch cyclicSwitch,
       McLengthType intervalType,
       double interval,
       McLengthType durationType,
       double duration,
       McSource valueSource
)
Sub DigitalCamSwitch(
       output As McOutput,
       startPosition As Double,
       cyclicSwitch As McCamSwitch,
       intervalType As McLengthType,
       interval As Double,
       durationType As McLengthType,
       duration As Double,
       valueSource As McSource
)

Parameters

output

Type: McOutput

Selects which digital output will be controlled by the corresponding track.

 

startPosition

Type: double

The position from which the switch is on.

 

cyclicSwitch

Type: McCamSwitch

Controls the switching actions.

 

intervalType

Type: McLengthType

The type of interval. mcDistance and mcTime can be used.

 

interval

Type: double

The length of a cycle. It depends on the intervalType you select. This value must be positive.

 

durationType

Type: McLengthType

The type of duration. mcDistance and mcCount can be used.

 

duration

Type: double

The duration over which the cycle repeats. It depends on the durationType you select.

 

valueSource

Type: McSource

Defines the source for axis values. For example, positions:

Remarks

Use cases:

The following cases are in the RT/Win32 interface, but they help you understand how a cyclic switch work.

Case 1

A cyclic switch completes its task for the duration.

McOutput outputBit = {
   FALSE,   //Axis or IO module. FALSE = I/O.
   0,       //Index
   0        //Offset
}

McCamSwitch cyclicSwitch = {
   0,    //TrackNumber
   40,   //FirstOnPosition 
   60,   //LastOnPosition
   1,    //AxisDirection. 1 = Positive.
   0,    //CamSwitchMode. 0 = Position.
   0     //Duration. It is not used in this case.
);

Command = SetAxisCyclicSwitch(
   TargetAxis,    //Index
   outputBit,     //Output
   100,           //StartPosition
   cyclicSwitch,  //CyclicSwitch
   mcDistance,    //IntervalType
   100,           //Interval
   mcDistance,    //DurationType
   250,           //Duration
   mcSetValue     //ValueSource
);

Case 2

A cyclic switch is aborted before it completes the task.

McOutput outputBit = {
   FALSE,   //Axis or IO module. FALSE = I/O.
   0,       //Index
   0        //Offset
}

McCamSwitch cyclicSwitch = {
   0,        //TrackNumber
   0,        //FirstOnPosition
   0,        //LastOnPosition
   1,        //AxisDirection. 1 = Positive.
   1,        //CamSwitchMode. 1 = Time.
   0.003     //Duration
);

Command = SetAxisCyclicSwitch(
   TargetAxis,    //Index
   outputBit,     //Output
   100,           //StartPosition
   cyclicSwitch,  //CyclicSwitch
   mcTime,        //IntervalType
   0.005,         //Interval
   mcCount,       //DurationType
   3,             //Duration
   mcSetValue     //ValueSource
);

See also

IAxis Interface

IntervalZero.KINGSTAR.Base.Class Namespace